//
//  WYCWelcomeController.m
//  WYCweibo
//
//  Created by 魏云超 on 15/11/22.
//  Copyright © 2015年 魏云超. All rights reserved.
//

#import "WYCWelcomeController.h"
#import <SDWebImage/UIImageView+WebCache.h>
#import "WYCAccount.h"
@interface WYCWelcomeController ()
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *iconConsTopLine;
@property (weak, nonatomic) IBOutlet UILabel *titleLabel;
@property (weak, nonatomic) IBOutlet UIImageView *iconImg;

@end

@implementation WYCWelcomeController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    //下载用户头像
    WYCAccount *account = [WYCAccount accountFromSandbox];
    NSString *url = account.profile_image_url;
    [self.iconImg sd_setImageWithURL:url placeholderImage:[UIImage imageNamed:@"abc"]];
    
   }

-(void)viewDidAppear:(BOOL)animated
{
    self.iconImg.layer.cornerRadius = 50;
    self.iconImg.layer.masksToBounds  = YES; //超出父层剪切掉
    [UIView animateWithDuration:1
                     animations:^{
                         self.iconConsTopLine.constant = -150;
                         [self.view layoutIfNeeded];
                     } completion:^(BOOL finished) {
                        //淡入淡出
                         [UIView animateWithDuration:1
                          animations:^{
                              self.titleLabel.alpha = 1.0;
                          } completion:^(BOOL finished) {
                              //跳转到首页
                              UIStoryboard *sb = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
                              [UIApplication sharedApplication].keyWindow.rootViewController = sb.instantiateInitialViewController;
                          }];
                     }];
    
}

@end
